<!DOCTYPE html>
<html>
{include file="head.html"}
<body>
<div class="body">
 <div class="header" >
    <a  class="left-btn" href="{$appshop}?m=list"><span class="iconfont icon-back"></span></a>
    <div class="title">商家信息</div>
     
  </div>
<div class="main-body ">
<div class="row">
 
    <form method='post' id="formx" action='{$appshop}?m=shop&a=save'>
      <input type='hidden' name='shopid' value='{$data.shopid}' >
       
          <table class='table noborder' width='100%'>
            
            
            <tr style="">
            	<td style="width:60px;">商家分类：</td>
                <td >
                	<select name="catid" class="w150">
    <option value="0">请选择</option>
    {foreach item=c from=$cat_list}
                <option value="{$c.catid}" {if $data.catid eq $c.catid} selected="selected"{/if}>{$c.cname}</option>
                {foreach item=c_2 from=$c.child}
                	<option value="{$c_2.catid}" {if $data.catid eq $c_2.catid} selected="selected"{/if} class="o_c_2">|__{$c_2.cname}</option>
                    {foreach item=c_3 from=$c_2.child}
                    <option value="{$c_3.catid}" {if $data.catid eq $c_3.catid} selected="selected"{/if} class="o_c_3"> |____{$c_3.cname}</option>
                    {/foreach}
                {/foreach}
                {/foreach}
    </select>
                
                </td>
            </tr>
            
            
            <tr>
              <td>商家名字：</td>
              <td><input type='text' name='shopname' id='shopname' class="w98" value='{$data.shopname}' ></td>
            </tr>
            <tr>
              <td>店主：</td>
              <td><input type='text' name='nickname' id='nickname' class="w98" value='{$data.nickname}' ></td>
            </tr>
          <tr>
              <td>联系电话：</td>
              <td><input type='text' name='telephone' id='telephone' class="w98" value='{$data.telephone}' ></td>
            </tr>
            
             <tr>
  	<td>公告:</td>
    <td>
    	<input type="radio" name="ggopen" value="0" {if !$data.ggopen} checked{/if}>关闭
    	<input type="radio" name="ggopen" value="1" {if $data.ggopen} checked{/if}>开启
    </td>
  </tr> 
                  <tr>
  	<td>公告内容:</td>
    <td><input type="text" name="gonggao" value="{$data.gonggao}" class="w98"></td>
  </tr>
            
            <tr>
              <td style="width:60px;">所在地区</td>
              <td><div class="input-row">
                 <select name="sc_id" class="w98">
                    	<option value="0">请选择</option>
                        {get data=tc model=site_city fun=children(0)}
                        {foreach item=c from=$tc}
                        	<option value="{$c.sc_id}" {if $data.sc_id eq $c.sc_id} selected{/if}>{$c.title}</option>
                            {if $c.child}
                            {foreach item=cc from=$c.child}
                        	<option value="{$cc.sc_id}"  {if $data.sc_id eq $cc.sc_id} selected{/if}>|--{$cc.title}</option>
                            {/foreach}
                            {/if}
                        {/foreach}
                    </select>
                </div>
                 </td>
            </tr>
            
            <tr >
              <td>商家地址：</td>
              <td><input type='text' name='address' id='address' class="w98" value='{$data.address}' > （商家实际地址）
              <input type="hidden" name="lat" id="lat" value="{$data.lat}"> <input type="hidden" name="lng" id="lng" value="{$data.lng}">
              	<div><a href="javascript:;" style="color:red;" id="getGps">点击获取GPS</a> <span id="gps">{$data.lat},{$data.lng}</span></div>
              </td>
            </tr>
            
            <tr>
              <td>送货速度：</td>
              <td><input type='text' name='send_time' id='send_time' value='{$data.send_time}' ></td>
            </tr>
            <tr>
              <td>起送价：</td>
              <td><input type='text' name='send_startprice' id='send_startprice' value='{$data.send_startprice}' ></td>
            </tr>
            
            <tr><td>配送费</td>
            	<td>
            		默认运费
            		<input type="text" name="express_fee" value="{$data.express_fee}" size="2">元  ，       
					订单少于<input type="text" name="express_lowmoney" value="{$data.express_lowmoney}" size="2"> 
					元付运费<input type="text" name="express_low_fee" value="{$data.express_low_fee}" size="2">元
            	
            	
            	</td>
            	
            </tr>
            
             
            
             <tr><td>营业开始：</td><td><input type='text' name='yystart' id='yystart' value='{if $data.yystart}{$data.yystart}{else}18:00{/if}' onClick="WdatePicker({dateFmt:'HH:mm'})" ></td></tr>
  <tr><td>营业结束：</td><td><input type='text' name='yyend' id='yyend' value='{if $data.yyend}{$data.yyend}{else}23:59{/if}' onClick="WdatePicker({dateFmt:'HH:mm'})"></td></tr>
           
            
            <tr>
            	<td>客服QQ：</td>
                <td><input type="text" name="qq" class="w98" id="qq" value="{$data.qq}" />(多个QQ用空格 隔开,如:333223 322233)</td>
            </tr>
            
            
           
            {if $data}
            <tr>
              <td>添加时间：</td>
              <td>{$data.dateline|date:Y-m-d H:i:s}</td>
            </tr>
            
            {/if}
           <tr>
              <td>logo：</td>
              <td> <div id="up1" url="/index.php?m=upload&a=uploadtao&dir=shop&id={$data.id}">
    	<div class="btn-upload">
          <input type="file" name="upimg" id="ud"  class="btn-upload-file" onChange="uploadimg('up1')">
         </div>
 
          <input type="hidden" name="logo" class="imgurl" value="{$data.logo}">
          <span class="imgShow">
          {if $data.logo}
          <img src="{$data.logo|images_site}.100x100.jpg">
          {/if}
          </span>
      </div></td>
            </tr>
            
            
             <tr>
              <td>Banner：</td>
              <td> <div id="up2" url="/index.php?m=upload&a=uploadtao&dir=shop&id={$data.id}">
    	<div class="btn-upload">
          <input type="file" name="upimg" id="ud2"  class="btn-upload-file" onChange="uploadimg('up2')">
         </div>
 
          <input type="hidden" name="banner" class="imgurl" value="{$data.banner}">
          <span class="imgShow">
          {if $data.banner}
          <img src="{$data.banner|images_site}.100x100.jpg">
          {/if}
          </span>
      </div></td>
            </tr>
             
            <tr>
              <td>审核状态：</td>
              <td>{if $data.status eq 2}已审核{else}未审核{/if}</td>
            </tr>
            
            <tr>
            	<td>主营产品：</td>
                <td><input type="text" name="zhuying"  value="{$data.zhuying}" class="w98"></td>
            </tr>
            
            <tr style="">
              <td>简介：</td>
              <td><textarea type='text' name='info' id='info'  style="width:90%; height:60px;" >{$data.info}</textarea></td>
            </tr>
            
            
            <tr>
            	<td colspan="2"><script type="text/html" name="content" id="content">{$data.content}</script></td>
            </tr>
             
            
          </table>
     
      <div style="height:50px; line-height:50px;padding-left:100px">
        <button type='button'    id="submit" class='btn btn-success'>保存</button>
      </div>
    </form>
  </div>
</div>
<script language="javascript" src="/plugin/My97DatePicker/WdatePicker.js"></script> 
<script src="/plugin/skyweb/lrz.mobile.min.js" ></script>
<script src="/static/js/upload_wap.js"></script>
{php loadEditor();} 
<script>
 var editor=UE.getEditor('content',options)
	
$(document).ready(function(){
	setTimeout(function(){
	   $("#p_latlng").removeClass("active");
   },300);
	$("#sc_top").bind("change",function(){
		$.get("{$appshop}?m=admin_site_city&a=Child&sc_id="+$(this).val(),function(data){
			$("#sc_2nd").empty().append(data);
		});
	});
	
	$("#sc_2nd").bind("change",function(){
		$.get("{$appshop}?m=admin_site_city&a=Child&sc_id="+$(this).val(),function(data){
			$("#sc_3nd").empty().append(data);
		});
	});
	
	
	$("#catid_top").bind("change",function(){
		var v=$(this).val();
		$.get("{const.appshop}?m=admin_product&a=catChild",{id:v},function(data){			
			
			if($("<div>"+data+"<div>").find("option").length==1){
				$("#catid_2nd").empty().append(data).hide();
			}else{
				$("#catid_2nd").empty().append(data).show();
			}
			$("#catid_3nd").empty().hide();
			
		});
	 
	});
	$("#catid_2nd").bind("change",function(){
		var v=$(this).val();
		$.get("{const.appshop}?m=admin_product&a=catChild",{id:v},function(data){
			if($("<div>"+data+"<div>").find("option").length==1){
				$("#catid_3nd").empty().append(data).hide();
			}else{
				$("#catid_3nd").empty().append(data).show();
			}
			
		});
		 
	}); 
	
	$("#submit").on("click",function(){
		$.post("/shopadmin.php?m=shop&a=save&ajax=1",$("#formx").serialize(),function(data){
			if(data.error){
				skyToast(data.message);
			}else{
				skyToast('保存成功');
			}
		},"json")
	});
	
	
});
</script> 
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak={const.BDMAPKEY}"></script> 
<script>
var lat,lng;
var geolocation = new BMap.Geolocation();
	
$(function(){
	$("#getGps").on(CLICK,function(){
		geolocation.getCurrentPosition(function(r){
		if(this.getStatus() == BMAP_STATUS_SUCCESS){
			lat=r.point.lat;
			lng=r.point.lng;
			$("#lat").val(lat);
			$("#lng").val(lng);
			$("#gps").html(lat+","+lng);
		}
		else {
			alert('failed'+this.getStatus());
		}        
	},{enableHighAccuracy: true})
		
	});
});
</script>    
{include file="footer.html"}
</div>
</body>
</html>    

 